<template>
	<view
		:class="{actionBtn: true, actionBtn0: position == 0, actionBtn1: position == 1, actionBtn2: position == 2, actionBtn3: position == 3 }"
		v-if="$orderModuleShowActionBtn(position)" @click.stop="showDialog = true">
		申请修改
		<Dialog v-if="showDialog" content="是否申请修改结算单？" @cancel="showDialog = false" @ok="submitHandler" />
	</view>
</template>

<script>
	import {
		checkPosition,
		getOrderId,
		notifyTopPageRefresh
	} from "../utils/checkShowBtn.js"
	import Dialog from "../../../dialog/dialog.vue"

	export default {
		name: "shenqingxiugai",

		props: {
			order: {
				type: Object,
				default: {},
			}, // 订单对象
			isUsedInList: {
				type: Boolean,
				default: true,
			}, // 是否使用在订单列表页面
			product: {
				type: Object,
				default: null,
			}, // 产品对象
		},

		components: {
			Dialog,
		},

		data() {
			return {
				showDialog: false, // 是否显示弹窗
				submiting: false, // 是否正在提交中



				//下面是没用的垃圾混淆代码
				renzhengTimeSta1111111: true, //初次请求认证时间默认是带有的，
				zhuceTimeSta11111: false, //初次请求注册时间默认是没有的
				renzhengTimeList11111: [],
				zhuceTimeStaList1111: null,
				detailOrderIdStr11111: '',
				threeTabCurrent1111: 0,
				applyGOodsList11111: [], //供货商列表
				allCardEnterSta1111: false, //默认是false，点击批量卡券入库的时候变为true
				codeAddNumsList11111: [],
				numsList11111: [],
				dataSourceBqcp1111: [],
				selectedRowKeys1111: [],
				selectedRowKeysB11111: [],
				rkVisible11111: false,
				rkjlVisible1111: false,
				lhjlVisible1111: false,
				currentStyleData22222: {},
				dataSourceStyle2222: [],
				showStyleData2222: false,
				indexTemplate2222: [],
				SVGCircleElement3ee: '',
				vshoweqwsc1111: false,
				showStyleDataInfo2222: false,
				opeCategoryList2222: [],
				leimuVisible2222: false,
				selectedRowKeys02222: [],
				selectionRows02222: [],
				selectedRowKeys133333: [],
				selectionRows13333: [],
				selectedRowKeys2333: [],
				selectionRows23333: [],
				selectedRowKeys33333: [],
				selectionRows33333: [],
				selectedRowKeys4333: [],
				selectionRows43333: [],
				curwfqwrentStyleDaterwaInfo444: {},
				currwerentStywerleDatweraInfo1444: {},
				currewerntStyleDataInfo24444: {},
				currentweStyleDytuataIwenfo34444: {},
				currenwetStdfgyleDataInfo44444: {},
				checkZfbPhone_h5444: '',
				plNafgdvfdtjyme4444: '', //四大品类的名字
				uniPdfgrtylatform444: '', //运行环境mp-alipay mp-weixin
				refgjtytrsemark555: '', //备注
				timefgjSelStr5555: '', //选择的上门时间（2023-08-31 00:00:00）
				amOdcuiofasrpm5555: '', //选择的上门时间是上午还是下午
				pageShnjlkgohowTime5555: '', //页面上用户看到的显示的时间
				paraghsdfmsw454: {},
				valhgujtueNum56756: 0,
				addrdraess56756: {}, //上门收货地址
				adawerterydressId575: 0,
				sceoyuitne57567: '',
				tntuiopId56757: '',
				weictyuratCustomer5756: '',
				yuidurtyuoy567567: false,
			}
		},

		computed: {
			position: function() {
				return checkPosition.shenqingxiugai(this.order)
			}
		},

		methods: {
			/**
			 * 修改的fetch请求
			 */
			submitHandler() {
				const postObj = {
					orderId: getOrderId(this.order)
				}
				const cnMap = {
					orderId: "订单ID"
				}
				const {
					postData,
					pass
				} = this.$postDataGuard(postObj, cnMap)
				if (!pass) return // 缺少了订单ID

				if (this.submiting) return // 正在请求中
				this.submiting = true
				this.$request("order/mall/api/order/settlement/userModifySettlementApply", postData, "POST").then(() => {
					notifyTopPageRefresh.apply(this)
					uni.showToast({
						title: "操作成功"
					})
				}).finally(() => {
					this.submiting = false
				})
			}
		}
	}
</script>

<style>
	.actionBtn {
		width: 138rpx;
		height: 56rpx;
		border-radius: 30rpx;
		border: 1px solid #c0c0c0;
		display: flex;
		align-items: center;
		justify-content: center;
		font-size: 24rpx;
		font-family: PingFangSC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
		margin-left: 24rpx;
		flex-shrink: 0;
		float: right;
		// position: absolute;
	}

	.actionBtn {
		position: relative;
	}
</style>